﻿@{
    ViewBag.Title = "知识分组";
    Layout = "~/Areas/Member/Views/Shared/_Layout.cshtml";
}

<div class="layui-tab layui-tab-brief" lay-filter="user">
    <div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 5px 0;">
        <form action="" class="layui-form">
            <a class="layui-btn" href="javascript:ShowPage2('/Management/KnowledgeCategory/Create','添加知识分组','800px','300px')">添加知识分组</a>
        </form>
    </div>
    <table class="layui-table" lay-data="{url:'GetData', cellMinWidth: 80, page: true,limit:20}" id="resultList" lay-filter="resultList">
        <thead>
            <tr>
                <th lay-data="{field:'ID', width:80}">ID</th>
                <th lay-data="{field:'Name'}">名称</th>
                <th lay-data="{field:'Sort',width:60}">排序</th>
                <th lay-data="{width:120, align:'center', toolbar: '#barDemo'}">操作</th>
            </tr>
        </thead>
    </table>
    <script type="text/html" id="barDemo">
        <a class="layui-btn layui-btn-primary layui-btn-xs" href="javascript:ShowPage2('/Management/KnowledgeCategory/Edit?id={{d.ID}}','修改{{d.Name}}','800px','300px')" lay-event="edit" lay-data="{{d}}">修改</a>
        <a class="layui-btn layui-btn-primary layui-btn-xs" href="javascript:DeleteItem({{d.ID}})">删除</a>
    </script>
</div>
<script type="text/javascript">
    function DeleteItem(id) {
        layer.confirm('您正在进行删除知识分组操作', {
            btn: ['是的,我要删除知识分组', '不小心点错了']
        }, function () {
            var url = "/Management/KnowledgeCategory/Delete?id=" + id;
            $.post(url, function (data) {
                if (data.State === 200) {
                    layer.msg("知识分组删除成功!");
                    $(".layui-laypage-btn")[0].click();
                }
                else {
                    layer.msg(data.Message);
                }
            }, 'json');
        }, function () {

        });
    }
</script>


